package track2.bayes;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import track2.context.Config;

public class getLargestId {
	public static int maxId = Integer.MIN_VALUE;

	public static void main(String[] args) throws IOException {
		getMaxId(Config.descriptionTokenPath);
		getMaxId(Config.purchaseKeywordTokenPath);
		getMaxId(Config.queryTokenPath);
		getMaxId(Config.titleTokenPath);
	}

	private static void getMaxId(String filename) throws NumberFormatException,
			IOException {
		BufferedReader br = new BufferedReader(new FileReader(filename));
		String line;
		while ((line = br.readLine()) != null) {
			String[] sp = line.split("\\t");
			String[] num = sp[1].split("\\|");

			for (int i = 0; i < num.length; i++) {
				int value = Integer.parseInt(num[i]);
				if (value > maxId) {
					maxId = value;
				}

			}
		}
		System.out.println(filename + ":" + "\t" + maxId);
	}

}
